function openFile() {
    $("#videoData").trigger("click");
}
//前端上传视频
function showImg(obj){
    var patter = /(\.*.mp3$)|(\.*.mp4$)|(\.*.wmv$)|(\.*.mov$)|(\.*.MP3$)|(\.*.MP4$)|(\.*.WMV$)|(\.*.MOV$)/;
    if(!patter.test($(obj).val())){
        alert('系统不支持图片的格式');
    }else {
        $("#uploadvideo").removeAttr("disabled");
    }
}
$(function () {
    $("#uploadvideo").click(function () {

        video_save_submit();
    })
})
//提交保存
function video_save_submit() {
    var formdata = new FormData(document.getElementById("uploadForm"));
    const videoName = $("#videoName").val();
    const chapter= $("#chapter").val();

    if(videoName.length==0 || chapter.length==0){
        alert("不允许留空")
        return false;
    }
    if(isNaN(chapter)){
        alert("小节请用阿拉伯数字表示")
        return false;
    }
    $("#jindutiao").show();

    $.ajax({
        type:'POST',
        url:'/sy/video/uploadvideo',
        data: formdata,
        processData:false,
        contentType:false,
        async: true,
        cache: false,
        success:function(data){
            $("#videourl").text(data);
            $("#uploadsuccess").html('<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;关闭&nbsp;&nbsp;</button>')
            $("#jindutiao").hide();
            layer.msg('发布成功',{icon:1,time:1000});
        }

    });

}